package com.spring.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.spring.mapper.TalenMapper;
import com.spring.pojo.Talen;
import com.spring.service.TableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class TableServiceImpl implements TableService {
    @Autowired
    TalenMapper talenMapper ;

    @Override
    public int update(Talen talen) {
        UpdateWrapper<Talen> wrapper = new UpdateWrapper<>() ;
        wrapper.eq("uid",talen.getUid()) ;
        return talenMapper.update(talen,wrapper) ;
    }

    @Override
    public int insert(Talen talen) {
        return talenMapper.insert(talen) ;
    }



    @Override
    public Talen selectById(int id) {
        QueryWrapper<Talen> wrapper = new QueryWrapper<>() ;
        wrapper.eq("uid",id) ;
        return talenMapper.selectOne(wrapper);
    }

    @Override
    public List<Talen> selectAll() {
        QueryWrapper<Talen> wrapper = new QueryWrapper<>() ;
        return talenMapper.selectList(wrapper);
    }

    @Override
    public List<Talen> selectPassAll() {
        QueryWrapper<Talen> wrapper = new QueryWrapper<>() ;
        wrapper.eq("re_status","1");
        return talenMapper.selectList(wrapper);
    }
}
